<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Merchant;
use Illuminate\Http\Request;

class MerchantController extends Controller
{
    use ApiResponse;
    public function index(Request $request)
    {
        $result=Merchant::where('status',1)->paginate($request->get('size',10));
        return $this->data($result);
    }
    public function show($id)
    {
        $result=Merchant::with('user')->where('status',1)->find($id);
        if (!$result){
            return $this->message_error("已经不存在");
        }
        return $this->data($result);
    }
}
